//
//  BaseTreeViewController.m
//  MTreeViewFramework
//
//  Created by Micker on 16/3/31.
//  Copyright © 2016年 micker. All rights reserved.
//

#import "BaseTreeViewController.h"

static NSString *NODE_CELL_ID = @"NODE_CELL_ID";

@interface BaseTreeViewController () 
@end

@implementation BaseTreeViewController
@synthesize  shareApi;

- (void)viewDidLoad {
    [super viewDidLoad];
    shareApi=[LQRequestApi sharedInstance];
    shareApi.delegate=self;
    
//    self.view.backgroundColor = [UIColor colorWithRed:244.0f/255.0f green:244.0f/255.0f blue:244.0f/255.0f alpha:1];
//    self.treeView.backgroundColor = [UIColor clearColor];
    [self doConfigTreeView];
}

- (void) doConfigTreeView {
    
}

#pragma mark  调整自适应布局
- (void) adaptiveViewLayout:(UIView *)viewLayout{
    //视图自适应布局
    for (UIView *view in viewLayout.subviews) {
        view.frame = flexibleFrame(view.frame, NO);
        if ([view isKindOfClass:[UITextField class]]) {
            UITextField *viewField = (UITextField *)view;
            CGFloat fontSize = viewField.font.pointSize;
            viewField.font = [UIFont systemFontOfSize:fontSize*VerticalTexeRatio()];
        }else if ([view isKindOfClass:[UILabel class]]){
            UILabel *viewLabel = (UILabel *)view;
            CGFloat fontSize = viewLabel.font.pointSize;
            viewLabel.font = [UIFont systemFontOfSize:fontSize*VerticalTexeRatio()];
        }else if ([view isKindOfClass:[UIButton class]]){
            UIButton *viewButton = (UIButton *)view;
            CGFloat fontSize = viewButton.titleLabel.font.pointSize;
            viewButton.titleLabel.font = [UIFont systemFontOfSize:fontSize*VerticalTexeRatio()];
        }
        
    }
}
#pragma mark --
#pragma mark UITableView delegate



#pragma mark --
#pragma mark MTreeView delegate

- (void) treeView:(MTreeView *)treeView willexpandNodeAtIndexPath:(NSIndexPath *)indexPath {
}

- (void) treeView:(MTreeView *)treeView didexpandNodeAtIndexPath:(NSIndexPath *)indexPath {
}
#pragma mark - Custom mehtod
//返回
-(void) back:(id) sender{
    [self.navigationController  popViewControllerAnimated:YES];
}
- (void)backBtn{
    [self.navigationController popViewControllerAnimated:YES];
}

-(void)showWaitDialogForNetWork
{
    [self performSelector:@selector(showWaitDialogForWait:) withObject:nil afterDelay:0.001];
}
- (void)showWaitDialog:(NSString*)title state:(NSString*)state{
    
    [CWHUDTips showTips:title];
    
}
- (void)showWaitDialogForWait:(NSString *)str {
    
    [CWHUDTips showLoadingTips:@"加载中..."];
}

-(void)showWaitDialogForNetWorkDismissBySelf
{
    [self showWaitDialogForNetWork];
    double delayInSeconds = 1;
    dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC);
    dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
        [self dismissWaitDialog];
    });
    
}

-(void)action_swipeGesture:(UISwipeGestureRecognizer *)gesture{
    if (gesture.direction == UISwipeGestureRecognizerDirectionRight){
        [self.navigationController  popViewControllerAnimated:YES];
    }
    
}



-(void)dismissWaitDialog
{
    [CWHUDTips hideTips];
    
}

@end
